package com.ex.cc;
 
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
public class ReduceClass extends Reducer<Text, IntWritable, Text, IntWritable> {
	IntWritable result = new IntWritable();
	int i = 1;
	public void reduce(Text	key, Iterable<IntWritable> values, Context context) throws IOException,InterruptedException {
		System.out.printf("\nReduceClass %s",i);
		i++;
		int sum = 0;
		for(IntWritable val:values) {
			System.out.printf("  |- ");
			System.out.print(val);
			System.out.printf(" - ");
			System.out.print(sum);
			sum += val.get();
		}
		result.set(sum);
		context.write(key,result);
	}
}